package com.david.exception;


import com.david.auth.pojo.result.ABizCode;

public class BusinessErrorException extends Exception {
  private static final long serialVersionUID = -6357149550353160810L;

  private final ABizCode error;

  private static final int DEFAULT_ERROR_CODE = -99;

  public BusinessErrorException(String message) {
    this(ABizCode.FAIL, message);
  }

  public BusinessErrorException(ABizCode error) {
    super(error.getMsg());
    this.error = error;
  }

  public BusinessErrorException(ABizCode error, String message) {
    super(message);
    this.error = error;
  }

  public BusinessErrorException(ABizCode error, Throwable cause) {
    super(error.toString(), cause);
    this.error = error;
  }

  public BusinessErrorException(Throwable cause) {
    super(cause.getMessage(), cause);
    this.error = ABizCode.EXCEPTION;
  }

  public ABizCode getError() {
    return this.error;
  }
}